<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr = [1,2,3,4,2,5,6,2,7,2];
        let remove = (arr,val)=>{
            let t = [];
            let index = 0;
            for(let i = 0;i < arr.length;++i){
                if(!filter(arr[i],val)) t[index++] = arr[i];
            }
            return t;
        }
        // function remove(){

        // }
        function filter(a,b){
            return a == b;
        }
        console.log(arr);
        remove(arr,2);
        console.log("需求一计算结果:"+arr);
        arr = [4,6,0,3,0, 0,0,1,3];
        arr.length = 9;
        console.log(arr);
        remove(arr,0);
        console.log("需求二计算结果:"+arr);

    </script>
</body>
</html>